package com.krahets88.doublepointer;

import org.junit.jupiter.api.Test;

public class Question392 {
    @Test
    public void test1(){
        Solution solution = new Solution();
        System.out.println(solution.isSubsequence("","ahbgdc"));
    }
    class Solution {
        public boolean isSubsequence(String s, String t) {
            if(s.isEmpty()){
                return true;
            }else if(t.isEmpty()){
                return false;
            }
            int j = 0;
            for (int i = 0; i < t.length(); i++) {
                if(j==s.length()){
                    return true;
                }
                if(t.charAt(i)==s.charAt(j)){
                    j++;
                }
            }
            return j == s.length();
        }
    }
}
